Enhancing AI with Prompt Engineering, RAG, and Agents
When leveraging AI for real-world applications, there are 3 frameworks/tools that should be discussed. Combining these three will give us accurate, specialized, and consistent answers. Here we go:
Prompt Engineering - Explaining yourself in a way that the LLM understands is critical. It makes sure you are both on the same page and that you get the answers you expect. No, this doesn't mean you need to spend lots of time editing and fixing your questions before sending them (though doing this will improve the answers you get). Most tools you use have what is called a system prompt; this gets sent to the LLM with EVERY question you send. What it does is set the stage for the LLM so it knows how to answer. The main problem is that, when using these tools, the system prompt is generic and probably doesn't fit your exact needs.
RAG (Retrieval Augmented Generation) - What this framework does is simple yet beautiful: it allows you to give the LLM specialized information and have it only answer using that information. The mechanics of how this works are a bit complex, and I will cover them in a different post.
Agents - When sending a prompt to an LLM, you receive an answer, but what if what you asked for required an action to be taken? Or additional reasoning to ensure the answer really is the best? An agent is an LLM that helps us manage our LLMs; it will help break down the request we send in and direct multiple resources to fulfill our needs.
Utilizing these three mechanisms or tools will help us create AI tools that can do amazing things.